import rospy
from geometry_msgs.msg import Twist


class CarController:
    def __init__(self):
        self.pub = rospy.Publisher('cmd_vel', Twist, queue_size=10)
        self.vel_msg = Twist()
        self.vel_msg.linear.x = 0.2

    def run(self):
        rospy.init_node('car_controller', anonymous=True)
        rate = rospy.Rate(10)
        while not rospy.is_shutdown():
            self.pub.publish(self.vel_msg)
            #rospy.loginfo('published to cmd_vel:'+self.vel_msg)
            rate.sleep()


if __name__ == "__main__":
    node = CarController()
    node.run()
